package com.firsteapps.mobile.android.puzzle.util;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class FirstRunChecker {
	private static final String FIRST_TIME_RUNNING = FirstRunChecker.class.getName() + ".first_time_running";
	private SharedPreferences sharedPreferences;

	public FirstRunChecker(SharedPreferences sharedPreferences) {
		this.sharedPreferences = sharedPreferences;
	}

	public boolean checkFirstRun() {
		boolean firstTimeRunning = sharedPreferences.getBoolean(FIRST_TIME_RUNNING, true);
		if (firstTimeRunning) {
			Editor e = sharedPreferences.edit();
			e.putBoolean(FIRST_TIME_RUNNING, false);
			e.commit();
		}
		return firstTimeRunning;
	}
}
